<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录界面</title>
    <link rel="stylesheet" href="css/login.css">
    <script type="text/javascript" src="easyui/jquery.min.js"></script>
    <script type="text/javascript">
        function login() {
            $('#msg').html('');
            if ($('#username').val() == '') {
                $('#msg').html('请输入用户名');
                return;
            }
            if ($('#password').val() == '') {
                $('#msg').html('请输入密码');
                return;
            }

            $.ajax({
                url:'http://localhost:8080/exchange/managers/login',
                type:'get',
                data:$('#logform').serialize(),
                dataType:'json',
                success:function(result){
                    if(result.code==200){
                        window.location.href="index.html";
                    }else{
                        $('#msg').text(result.msg);
                    }
                }
            });
          
        }

        function keyLogin() {
            if (event.keyCode == 13) {
                login();
            }
        }
    </script>
</head>

<body onkeydown="keyLogin()">
    <div class="login_box">
        <div class="login_l_img"><img src="images/login-img.png"></div>
        <div class="login">
            <div class="login_logo"><img src="images/login_logo.png"></div>
            <div class="login_name">
                <p>置换信息平台管理系统</p>
                <span id="msg"></span>
            </div>
            <form action="./index.html" method="get" id="logform">
                <input type="text" name="username" id="username" placeholder="用户名">
                <input type="password" name="password" id="password" placeholder="密码">
                <input value="登录" style="width:100%;" type="button" onclick="login()">
            </form>
        </div>
    </div>
</body>

</html>